package com.zqh.irmadscore.controller;


import com.zqh.irmadscore.model.entity.TestData;
import com.zqh.irmadscore.service.TestService;
import com.zqh.irmadscore.utils.resultUtils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
@RequiredArgsConstructor
@Tag(name = "测试数据")
public class TestController {

    private final TestService testService;


    @Operation(summary = "获取所有监测数据")
    @GetMapping("/getAllTestData")
    public Result<List<TestData>> getTestData() {

        var list =  testService.list();
        return Result.ok(list);
    }

    // 寻找异常的监测数据
    @Operation(summary = "获取所有异常的监测数据")
    @GetMapping("/getAllAbnormalTestData")
    public Result<List<TestData>> getAbnormalTestData(long minNum, long MaxNum) {

        List<TestData> list =  testService.getAbnormalTestData(minNum,MaxNum);

        return Result.ok(list);

    }



    @GetMapping("/testData2")
    public Result<Object> testData2() {

      var test =   testService.getPageList();
      System.out.println(test);
      return Result.ok(test);
    }




}
